package cn.glow.readingcloud.common.result;


import lombok.Data;

import java.io.Serializable;

/**
 * @Author Glow
 * @Date 2023-04-10 14:34:14
 * @Description 返回前台结果封装
 * @Version 1.0
 */
@Data
public class Result<T> implements Serializable {
        private static final long serialVersionUID = 1L ;
        private int code;
        private String msg;
        private T data;
        public Result()
        {

        }
        public Result( int code ,String msg, T data)
        {
            this.code = code;
            this.msg =  msg;
            this.data = data;
        }
        public Result(int code ,String msg)
        {
            this.code = code;
            this.msg = msg;
        }
        public Result buildMessage(String msg)
        {
            this.setMsg(msg);
            return this;
        }
        public Result buildCode(int code)
        {
            this.setCode(code);
            return  this;
        }
        public Result buildData(T obj)
        {
            this.setData(obj);
            return this;
        }
}
